/****************************************************************************
**
** Packet.h
**
** Copyright (C) August 2014 Hotride
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
** GNU General Public License for more details.
**
*****************************************************************************
*/
//---------------------------------------------------------------------------
#ifndef PacketH
#define PacketH
//---------------------------------------------------------------------------
#include <windows.h>
//---------------------------------------------------------------------------
class TMessageFragment
{
private:
	PBYTE m_data;
	int m_size;
	int m_msg_size;

public:
	TMessageFragment(PBYTE buf, int size, int msg_size);
	~TMessageFragment() {delete m_data;}

	int Append(PBYTE buf, int size);

	bool Complete() const {return m_size == m_msg_size && m_msg_size != 0;}

	PBYTE Get() {return m_data;}
	int Size() {return m_size;}
};
//---------------------------------------------------------------------------
#endif